import { ref } from 'vue';
import { defineStore } from 'pinia'

export default defineStore('user', () => {
    // 登录的token内容
    const token = ref<string | null>(null);
    const userInfo = ref<any>({
        roles: [
            // 'admin',
            'user',
            'counter',
        ],
        name: 'hyw'
    });

    // 清除用户信息
    const clearUserInfo = () => {
        token.value = null;
        userInfo.value = null;
    }

    return {
        token,
        userInfo,
    }
})